WTL Controls
|
Back to the WTL Controls Home Page. |
A CStatic descendant providing a context menu with a single entry, allowing the launch of the default browser to a pre - defined URL. More...
#include <HyperlinkImage.h>
Public Member Functions | |
CHyperlinkImage () noexcept | |
virtual | ~CHyperlinkImage () |
void | SubclassStatic (HWND hWnd) |
Subclass a Static TExt control window. More... | |
void | UnSubclassStatic () |
Un-subclass the window. More... | |
void | SetURL (std::basic_string< TCHAR > url) |
Load a new target URL More... | |
std::basic_string< TCHAR > | GetURL () const |
Default: "". More... | |
void | SetMenuText (std::basic_string< TCHAR > text) |
Load text to be displayed in the context menu item. More... | |
std::basic_string< TCHAR > | GetMenuText () const |
Default: "". More... | |
A CStatic descendant providing a context menu with a single entry, allowing the launch of the default browser to a pre - defined URL.
This class is intended for use with the 'PictureBox' control found in the VC++ Dialog Editor toolbox. (This is, of course, a static text control with one of the relevant window styles (e.g, SS_BITMAP, SS_ICON) set.) The inherited CStatic::SetIcon, CStatic::SetBitmap, etc, member functions can be used to load an image.
Usage is a bit complicated. You have to add the following menu definition to the client project .rc file:
In addition, you must manually modify the client project .rc file TEXTINCLUDE2 resource to include the wtl_controls_resources.h file, as this is where the menu and command resource values are defined; e.g.,
Assuming all this has been done, typical usage is depicted below.
Definition at line 61 of file HyperlinkImage.h.
|
noexcept |
Definition at line 20 of file HyperlinkImage.cpp.
|
virtual |
Definition at line 25 of file HyperlinkImage.cpp.
void BIS_WTL_CONTROLS::CHyperlinkImage::SubclassStatic | ( | HWND | hWnd | ) |
Subclass a Static TExt control window.
The SS_NOTIFY flag is added to the control's window styles, as well.
hWnd | The handle of the static text control window to be subclassed. |
void |
Definition at line 41 of file HyperlinkImage.cpp.
void BIS_WTL_CONTROLS::CHyperlinkImage::UnSubclassStatic | ( | ) |
void BIS_WTL_CONTROLS::CHyperlinkImage::SetURL | ( | std::basic_string< TCHAR > | url | ) |
Load a new target URL
url | The new target URL. |
void |
Definition at line 71 of file HyperlinkImage.cpp.
std::basic_string< TCHAR > BIS_WTL_CONTROLS::CHyperlinkImage::GetURL | ( | ) | const |
Default: "".
Returns the target URL; i.e., the URL the default browser will launch to when the context menu item is clicked.
std::basic_string<TCHAR> |
Definition at line 84 of file HyperlinkImage.cpp.
void BIS_WTL_CONTROLS::CHyperlinkImage::SetMenuText | ( | std::basic_string< TCHAR > | text | ) |
Load text to be displayed in the context menu item.
text | New menu item text. |
void |
Definition at line 99 of file HyperlinkImage.cpp.
std::basic_string< TCHAR > BIS_WTL_CONTROLS::CHyperlinkImage::GetMenuText | ( | ) | const |
Default: "".
Returns the text to be displayed in the context menu item.
std::basic_string<TCHAR> | The menu item text. |
Definition at line 112 of file HyperlinkImage.cpp.